Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pserve --reload does not keep worker arguments. Fixes #2961 #2962

Merged
merged 5 commits into from
Mar 6, 2017

Conversation

Natim
Copy link

@Natim Natim commented Feb 20, 2017

Refs #2961

Natim pushed a commit to Kinto/kinto that referenced this pull request Feb 20, 2017
@Natim
Copy link
Author

Natim commented Feb 20, 2017

r? @mmerickel

@digitalresistor
Copy link
Member

Please don't mix whitespace/pep8 fixes in with the rest of the commit in the future. It makes it more difficult to see what the changes are.

@@ -1,9 +1,11 @@
import mock
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't currently use mock in the the Pyramid tests, instead we create dummy objects that have just the functionality required.

I don't think it is a great idea to add yet another dependency...

setup.py Outdated
@@ -65,9 +65,10 @@
]

testing_extras = tests_require + [
'mock',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a -1 on this, we use dummy objects everywhere else.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By the way this dependencies are only installed when you run tests which is not something you do when you use the project.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, I understand that.

@Natim
Copy link
Author

Natim commented Feb 20, 2017

Please don't mix whitespace/pep8 fixes in with the rest of the commit in the future. It makes it more difficult to see what the changes are.

That's why I put them in another commit so that you can look at the diff without them.

I don't think it is a great idea to add yet another dependency...

It doesn't change anything to add another dependency, but I will try to rewrite my test with a Dummy object instead. (mock just makes it easy to do so with less code to maintain.)

Copy link
Member

@mmerickel mmerickel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks correct but it does need to stop using mock as @bertjwregeer mentioned.

@mmerickel
Copy link
Member

ping @Natim

@Natim
Copy link
Author

Natim commented Feb 27, 2017

Hi @mmerickel, I didn't forget about this and I am going to rewrite tests without mocks.

@mmerickel
Copy link
Member

@Natim Okie sounds good.. just wanted to make sure it wasn't forgotten!

@Natim
Copy link
Author

Natim commented Feb 27, 2017

To be honest I find the code much harder to maintain with a test like that. Are you sure it worth getting rid of the mock dependency?

@Natim Natim force-pushed the 2961-hupper-call-broken branch 2 times, most recently from 432db17 to 4f1e551 Compare February 27, 2017 17:47
@Natim Natim force-pushed the 2961-hupper-call-broken branch from 4f1e551 to 1702daa Compare February 27, 2017 17:55
@Natim
Copy link
Author

Natim commented Feb 27, 2017

@bertjwregeer @mmerickel how does it look to you now?

@Natim
Copy link
Author

Natim commented Mar 3, 2017

Any news about it?

Natim pushed a commit to Kinto/kinto that referenced this pull request Mar 3, 2017
@Natim Natim mentioned this pull request Mar 3, 2017
1 task
start_reloader=dummy_start_reloader)

inst = self._makeOne('--reload', 'development.ini')
inst.run()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know we aren't using mock (sorry!) but if you're patching a module-scope value, you need to replace it after the test is over. For example:

orig_hupper = pserve.hupper
try:
    pserve.hupper = ...
    inst = ...
    inst.run()
finally:
    pserve.hupper = orig_hupper

@Natim
Copy link
Author

Natim commented Mar 3, 2017

I know we aren't using mock (sorry!)

Why cannot we start?

@mmerickel
Copy link
Member

Why cannot we start?

Well I'm not adding a new dependency in a bugfix release and I imagine we want to backport this to 1.8. I'm definitely open to improving this situation in 1.9 though.

@Natim
Copy link
Author

Natim commented Mar 3, 2017

Well I'm not adding a new dependency in a bugfix release and I imagine we want to backport this to 1.8. I'm definitely open to improving this situation in 1.9 though.

Ok it makes sense 👍

@mmerickel
Copy link
Member

Just waiting on @bertjwregeer to approve this before I continue.

@Natim if you come back with more bugs the day after I cut a new release again I'm going to bonk you on the head if I ever see you in person!

Copy link
Member

@digitalresistor digitalresistor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm good with this change.

@digitalresistor
Copy link
Member

I will say that I am not all that excited about using Mock. I feel like mock is overused for "magic" to make tests pass, and it just overall makes a bad experience for writing tests. I think we can try to use it, but we have to be careful to not be overly reliant on it.

@mmerickel mmerickel merged commit 780d693 into Pylons:master Mar 6, 2017
mmerickel added a commit that referenced this pull request Mar 6, 2017
@Natim
Copy link
Author

Natim commented Mar 6, 2017

Hopefully releases are cheap :)

@Natim Natim deleted the 2961-hupper-call-broken branch March 6, 2017 08:43
@mmerickel
Copy link
Member

@Natim I wish that were true. :-(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants